import { isHidden } from "vant/lib/utils";
import { createRouter, createWebHashHistory } from "vue-router";
const defRoutes = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    name: "login",
    path: "/login",
    component: () => import("@/views/login/login.vue"),
  },
];
export const routes = [
  {
    path: "/home",
    name: "Home",
    redirect: "/leaderHome",
    meta: { title: "系统首页", icon: "icon-xianxingtubiaozhizuomoban-47" },
    children: [
      {
        path: "/comCenter",
        component: () => import("@/views/home/comCenter.vue"),
        name: "ComCenter",
        meta: { title: "数据统计", icon: "icon-xianxingtubiaozhizuomoban-47" },
      },
      {
        path: "/homePayRecord",
        component: () => import("@/views/home/homePayRecord.vue"),
        name: "HomePayRecord",
        meta: {
          title: "后台充值记录",
          icon: "icon-xianxingtubiaozhizuomoban-47",
        },
      },
      {
        path: "/homeXcxPayRecord",
        component: () => import("@/views/home/homeXcxPayRecord.vue"),
        name: "homeXcxPayRecord",
        meta: {
          title: "小程序充值记录",
          icon: "icon-xianxingtubiaozhizuomoban-47",
        },
      },

      {
        path: "/homeUser",
        component: () => import("@/views/home/homeUser.vue"),
        name: "HomeUser",
        meta: { title: "平台用户", icon: "icon-xianxingtubiaozhizuomoban-47" },
      },
    ],
  },
  {
    path: "/booter",
    name: "Booter",
    redirect: "/booterList",
    meta: { title: "船东管理", icon: "icon-xianxingtubiaozhizuomoban-47" },
    children: [
      {
        path: "/booterList",
        component: () => import("@/views/booter/booterList.vue"),
        name: "BooterList",
        meta: { title: "船东列表", icon: "icon-xianxingtubiaozhizuomoban-47" },
      },
      {
        path: "/booterListAdd",
        isHidden: true,
        component: () => import("@/views/booter/booterList/booterListAdd.vue"),
        name: "BooterListAdd",
        meta: { title: "新增船东", icon: "icon-xianxingtubiaozhizuomoban-47" },
      },
      {
        path: "/booterListDetail",
        isHidden: true,
        component: () =>
          import("@/views/booter/booterList/booterListDetail.vue"),
        name: "BooterListDetail",
        meta: { title: "新增详情", icon: "icon-xianxingtubiaozhizuomoban-47" },
      },
      {
        path: "/booterWork",
        component: () => import("@/views/booter/booterWork.vue"),
        name: "BooterWork",
        meta: { title: "岗位代招", icon: "icon-xianxingtubiaozhizuomoban-47" },
      },
      {
        path: "/booterWorkDetail",
        isHidden: true,
        component: () => import("@/views/booter/booterWorkDetail.vue"),
        name: "booterWorkDetail",
        meta: {
          title: "岗位代招详情",
          icon: "icon-xianxingtubiaozhizuomoban-47",
        },
      },
    ],
  },
  {
    path: "/school",
    name: "school",
    redirect: "/schoolList",
    meta: { title: "学校管理", icon: "icon-xianxingtubiaozhizuomoban-47" },
    children: [
      {
        path: "/schoolList",
        component: () => import("@/views/school/schoolList.vue"),
        name: "schoolList",
        meta: { title: "学校列表", icon: "icon-xianxingtubiaozhizuomoban-47" },
      },
      {
        path: "/schoolListAdd",
        isHidden: true,
        component: () => import("@/views/school/schoolList/schoolListAdd.vue"),
        name: "schoolListAdd",
        meta: { title: "新增学校", icon: "icon-xianxingtubiaozhizuomoban-47" },
      },
      {
        path: "/schoolListDetail",
        isHidden: true,
        component: () =>
          import("@/views/school/schoolList/schoolListDetail.vue"),
        name: "schoolListDetail",
        meta: { title: "学校详情", icon: "icon-xianxingtubiaozhizuomoban-47" },
      },
    ],
  },
  {
    path: "/work",
    name: "work",
    redirect: "/accountCompany",
    meta: { title: "账号管理", icon: "icon-gangwei" },
    children: [
      {
        path: "/accountCompany",
        component: () => import("@/views/account/accountCompany.vue"),
        name: "AccountCompany",
        meta: { title: "企业账号", icon: "icon-gangwei" },
      },
      {
        path: "/accountCompanyAdd",
        isHidden: true,
        component: () =>
          import("@/views/account/accountCompany/accountCompanyAdd.vue"),
        name: "AccountCompanyAdd",
        meta: { title: "新增企业账号" },
      },
      {
        path: "/accountCompanyDetail",
        isHidden: true,
        component: () =>
          import("@/views/account/accountCompany/accountCompanyDetail.vue"),
        name: "AccountCompanyDetail",
        meta: { title: "企业账号详情" },
      },
      {
        path: "/accountTrain",
        component: () => import("@/views/account/accountTrain.vue"),
        name: "AccountTrain",
        meta: { title: "培训账号", icon: "icon-gangwei" },
      },
      {
        path: "/accountTrainAdd",
        isHidden: true,
        component: () =>
          import("@/views/account/accountTrain/accountTrainAdd.vue"),
        name: "AccountTrainAdd",
        meta: { title: "新增培训账号" },
      },
      {
        path: "/accountTrainDetail",
        isHidden: true,
        component: () =>
          import("@/views/account/accountTrain/accountTrainDetail.vue"),
        name: "AccountTrainDetail",
        meta: { title: "培训账号详情" },
      },
      {
        path: "/accountObtai",
        component: () => import("@/views/account/accountObtai.vue"),
        name: "accountObtai",
        meta: { title: "办证账号", icon: "icon-gangwei" },
      },
      {
        path: "/accountObtaiAdd",
        isHidden: true,
        component: () =>
          import("@/views/account/accountObtai/accountObtaiAdd.vue"),
        name: "accountObtaiAdd",
        meta: { title: "办证账号新增", icon: "icon-gangwei" },
      },
      {
        path: "/accountStaff",
        component: () => import("@/views/account/accountStaff.vue"),
        name: "AccountStaff",
        meta: { title: "员工账号", icon: "icon-gangwei" },
      },
      {
        path: "/accountXcxCom",
        component: () => import("@/views/account/accountXcxCom.vue"),
        name: "accountXcxCom",
        meta: { title: "小程序账号", icon: "icon-gangwei" },
      },
      {
        path: "/accountRecord",
        component: () => import("@/views/account/accountRecord.vue"),
        name: "AccountRecord",
        meta: { title: "续费记录", icon: "icon-gangwei" },
      },
    ],
  },
  {
    path: "/sala",
    name: "Sala",
    redirect: "/workList",
    meta: { title: "船员大厅", icon: "icon-wodejianli" },
    children: [
      {
        path: "/salaPublic",
        component: () => import("@/views/sala/salaPublic.vue"),
        name: "SalaPublic",
        meta: { title: "公海池", icon: "icon-hulianwang" },
      },
      {
        path: "/salaPublicDetail",
        isHidden: true,
        component: () => import("@/views/sala/salaPublic/salaPublicDetail.vue"),
        name: "SalaPublicDetail",
        meta: { title: "船员简历详情" },
      },
      {
        path: "/salaSelf",
        component: () => import("@/views/sala/salaSelf.vue"),
        name: "SalaSelf",
        meta: { title: "人才库", icon: "icon-private-net" },
      },
      {
        path: "/salaSave",
        component: () => import("@/views/sala/salaSave.vue"),
        name: "SalaSave",
        meta: { title: "船员收藏", icon: "icon-shoucang1" },
      },
      {
        path: "/salaSign",
        component: () => import("@/views/sala/salaSign.vue"),
        name: "salaSign",
        meta: { title: "签约记录", icon: "icon-shoucang1" },
      },
      {
        path: "/salaInteview",
        component: () => import("@/views/sala/salaInteview.vue"),
        name: "salaInteview",
        meta: { title: "面试记录", icon: "icon-shoucang1" },
      },
      {
        path: "/salaInteviewDetail",
        isHidden: true,
        component: () => import("@/views/sala/salaInteviewDetail.vue"),
        name: "salaInteviewDetail",
        meta: { title: "面试记录详情", icon: "icon-shoucang1" },
      },
      {
        path: "/salaSignDetail",
        isHidden: true,
        component: () => import("@/views/sala/salaSignDetail.vue"),
        name: "salaSignDetail",
        meta: { title: "签约记录详情", icon: "icon-shoucang1" },
      },
    ],
  },
  {
    path: "/send",
    name: "Send",
    redirect: "/sendWork",
    meta: { title: "发布中心", icon: "icon-wodejianli" },
    children: [
      {
        path: "/sendWork",
        component: () => import("@/views/send/sendWork.vue"),
        name: "SendWork",
        meta: { title: "岗位列表", icon: "icon-hulianwang" },
      },
      {
        path: "/sendWorkDetail",
        isHidden: true,
        component: () => import("@/views/send/sendWorkDetail.vue"),
        name: "SendWorkDetail",
        meta: { title: "岗位详情" },
      },
      {
        path: "/sendWorkAdd",
        isHidden: true,
        component: () => import("@/views/send/sendWorkAdd.vue"),
        name: "sendWorkAdd",
        meta: { title: "新增岗位" },
      },
      {
        path: "/sendTrain",
        component: () => import("@/views/send/sendTrain.vue"),
        name: "SendTrain",
        meta: { title: "培训列表", icon: "icon-hulianwang" },
      },
      {
        path: "/sendTrainDetail",
        isHidden: true,
        component: () => import("@/views/send/sendTrainDetail.vue"),
        name: "SendTrainDetail",
        meta: { title: "培训详情" },
      },
    ],
  },
  {
    path: "/idea",
    name: "Idea",
    redirect: "/ideaCallback",
    meta: { title: "反馈举报", icon: "icon-wodejianli" },
    children: [
      {
        path: "/ideaCallback",
        component: () => import("@/views/idea/ideaCallback.vue"),
        name: "IdeaCallback",
        meta: { title: "意见反馈", icon: "icon-hulianwang" },
      },
      {
        path: "/ideaReport",
        component: () => import("@/views/idea/ideaReport.vue"),
        name: "IdeaReport",
        meta: { title: "举报中心", icon: "icon-hulianwang" },
      },
    ],
  },
  {
    path: "/integral",
    name: "Integral",
    redirect: "/integralProduct",
    meta: { title: "积分管理", icon: "icon-wodejianli" },
    children: [
      {
        path: "/integralProduct",
        component: () => import("@/views/integral/integralProduct.vue"),
        name: "IntegralProduct",
        meta: { title: "积分商品", icon: "icon-hulianwang" },
      },
      {
        path: "/integralProductAdd",
        isHidden: true,
        component: () =>
          import("@/views/integral/integralProduct/integralProductAdd.vue"),
        name: "IntegralProductAdd",
        meta: { title: "积分商品", icon: "icon-hulianwang" },
      },
      {
        path: "/integralRecord",
        component: () => import("@/views/integral/integralRecord.vue"),
        name: "IntegralRecord",
        meta: { title: "兑换记录", icon: "icon-hulianwang" },
      },
    ],
  },
  {
    path: "/extend",
    name: "extend",
    redirect: "/extendUser",
    meta: { title: "佣金中心", icon: "icon-wodejianli" },
    children: [
      {
        path: "/extendUser",
        component: () => import("@/views/extend/extendUser.vue"),
        name: "extendUser",
        meta: { title: "推广员列表", icon: "icon-hulianwang" },
      },
      {
        path: "/extendRecord",
        component: () => import("@/views/extend/extendRecord.vue"),
        name: "extendRecord",
        meta: { title: "提现申请", icon: "icon-hulianwang" },
      },
      {
        path: "/extendUserDetail",
        isHidden: true,
        component: () => import("@/views/extend/extendUserDetail.vue"),
        name: "extendUserDetail",
        meta: { title: "推广员详情", icon: "icon-hulianwang" },
      },
    ],
  },
  {
    path: "/set",
    name: "Set",
    redirect: "/integralProduct",
    meta: { title: "设置中心", icon: "icon-wodejianli" },
    children: [
      {
        path: "/setSelect",
        component: () => import("@/views/set/setSelect.vue"),
        name: "SetSelect",
        meta: { title: "数据字典", icon: "icon-hulianwang" },
      },
      {
        path: "/setPay",
        component: () => import("@/views/set/setPay.vue"),
        name: "SetPay",
        meta: { title: "充值设置", icon: "icon-hulianwang" },
      },
      {
        path: "/setXcxPay",
        component: () => import("@/views/set/setXcxPay.vue"),
        name: "setXcxPay",
        meta: { title: "小程序充值", icon: "icon-hulianwang" },
      },
      {
        path: "/setResume",
        component: () => import("@/views/set/setResume.vue"),
        name: "setResume",
        meta: { title: "解析套餐", icon: "icon-hulianwang" },
      },
      {
        path: "/setRenew",
        component: () => import("@/views/set/setRenew.vue"),
        name: "SetRenew",
        meta: { title: "续费设置", icon: "icon-hulianwang" },
      },
      {
        path: "/setWork",
        component: () => import("@/views/set/setWork.vue"),
        name: "SetWork",
        meta: { title: "岗位配置", icon: "icon-hulianwang" },
      },
      {
        path: "/setNotice",
        component: () => import("@/views/set/setNotice.vue"),
        name: "SetNotice",
        meta: { title: "公告设置", icon: "icon-hulianwang" },
      },
      {
        path: "/setNoticeAdd",
        isHidden: true,
        component: () => import("@/views/set/setNoticeAdd.vue"),
        name: "SetNoticeAdd",
        meta: { title: "公告设置", icon: "icon-hulianwang" },
      },
      {
        path: "/setQy",
        component: () => import("@/views/set/setQy.vue"),
        name: "setQy",
        meta: { title: "权益配置", icon: "icon-hulianwang" },
      },
      {
        path: "/setBanner",
        component: () => import("@/views/set/setBanner.vue"),
        name: "SetBanner",
        meta: { title: "轮播图设置", icon: "icon-hulianwang" },
      },
      {
        path: "/setShare",
        component: () => import("@/views/set/setShare.vue"),
        name: "SetShare",
        meta: { title: "分享推广", icon: "icon-hulianwang" },
      },
      {
        path: "/setOther",
        component: () => import("@/views/set/setOther.vue"),
        name: "SetOther",
        meta: { title: "其他设置", icon: "icon-hulianwang" },
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes: defRoutes.concat(routes),
});
router.beforeEach((to, from, next) => {
  if (from.query.page) {
    localStorage.setItem("boot_page", from.query.page);
  } else {
    localStorage.setItem("boot_page", 1);
  }
  next();
});

export default router;
